﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content3" ContentPlaceHolderID="JSContent" runat="server">
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <%: Html.Partial("Sidebar") %>
    <div id="main">
        <div class="main-block">
            <h2 class="title">
                <%:"My Account".Localize() %></h2>
            <div class="main-block-content clearfix">
                <div class="tabs">
                    <a href="<%= this.ViewData["ProfileLinks"].Bind("Profile") %>">
                        <%:"Account Info".Localize() %></a>
                    <a href="<%= this.ViewData["ProfileLinks"].Bind("Password") %>">
                        <%:"Change Password".Localize() %></a>
                    <a href="<%= this.ViewData["ProfileLinks"].Bind("Address") %>">
                        <%:"Address Lists".Localize() %></a>
                    <a class="current" href="<%= this.ViewData["ProfileLinks"].Bind("Order") %>">
                        <%:"My Orders".Localize() %></a>
                         <a href="<%= this.ViewData["ProfileLinks"].Bind("SupportTicket") %>">
                                        <%:"Support Ticket".Localize() %></a>
                </div>
                <div class="tab-content">
                    <strong>
                        <%:"Order ID:".Localize() %>#<%: ViewBag.Order.Id%></strong>
                    <div class="tab-block confirm-block">
                        <div>
                            <dl>
                                <dt>
                                    <%:"Shipping Method".Localize() %></dt>
                                <dd>
                                    <%: ViewBag.Order.ShippingName %></dd>
                            </dl>
                            <dl>
                                <dt>
                                    <%:"Shipping Address".Localize() %></dt>
                                <dd>
                                    <p>
                                        <%: ViewBag.Order.FirstName %>
                                        <%: ViewBag.Order.LastName %></p>
                                    <p>
                                        <%: ViewBag.Order.Address1 %>
                                        <%: ViewBag.Order.Address2 %></p>
                                    <p>
                                        <%: ViewBag.Order.City %>
                                        <%: ViewBag.Order.Postcode %></p>
                                    <p>
                                        <%: ViewBag.Order.State %></p>
                                    <p>
                                        <%: ViewBag.Order.Country %></p>
                                </dd>
                            </dl>
                        </div>
                        <div>
                            <dl>
                                <dt>
                                    <%:"Payment Method".Localize() %></dt>
                                <dd>
                                    <%: ViewBag.Order.PaymentName %></dd>
                            </dl>
                            <dl>
                                <dt>
                                    <%:"Payment Address".Localize() %></dt>
                                <dd>
                                    <p>
                                        <%: ViewBag.Order.InvoiceFirstName %>
                                        <%: ViewBag.Order.InvoiceLastName %></p>
                                    <p>
                                        <%: ViewBag.Order.InvoiceAddress1 %>
                                        <%: ViewBag.Order.InvoiceAddress2 %></p>
                                    <p>
                                        <%: ViewBag.Order.InvoiceCity %>
                                        <%: ViewBag.Order.InvoicePostcode %></p>
                                    <p>
                                        <%: ViewBag.Order.InvoiceState %></p>
                                    <p>
                                        <%: ViewBag.Order.InvoiceCountry %></p>
                                </dd>
                            </dl>
                        </div>
                    </div>
                    <div class="tab-block">
                        <div class="common-table">
                            <table>
                                <thead>
                                    <tr>
                                        <th>
                                            <%:"Name".Localize() %>
                                        </th>
                                        <th>
                                            <%:"Unit Price".Localize() %>
                                        </th>
                                        <th>
                                            <%:"Quantity".Localize() %>
                                        </th>
                                        <th>
                                            <%:"SubTotal".Localize() %>
                                        </th>
                                        <th>
                                            <%:"Discount".Localize() %>
                                        </th>
                                        <th>
                                            <%:"TaxCost".Localize() %>
                                        </th>
                                        <th>
                                            <%:"Total".Localize() %>
                                        </th>
                                        <th>
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <%                                        
                                        
                                        foreach (var item in ((IOrder)ViewBag.Order).OrderItems)
                                        {
                                    %>
                                    <tr>
                                        <td>
                                            <a href="<%: this.Url.Action("View", "Product", new { id = item.ProductId}) %>">
                                                <%: item.ProductName%></a>
                                        </td>
                                        <td>
                                            <%: item.UnitPrice.ToString("C") %>
                                        </td>
                                        <td>
                                            <%: item.Quantity%>
                                        </td>
                                        <td>
                                            <%: item.SubTotal.ToString("C")%>
                                        </td>
                                        <td>
                                            <%: item.Discount.ToString("C")%>
                                        </td>
                                        <td>
                                            <%: item.TaxCost.ToString("C")%>
                                        </td>
                                        <td>
                                            <%: item.Total.ToString("C")%>
                                        </td>
                                        <td>
                                            <%
                                            if (ViewBag.Order.OrderStatus == (int)OrderStatus.DeliveryCompleted)
                                            {
                                            %>
                                            <a href="<%: this.Url.Action("View", "Product", new { id = item.ProductId, orderid=ViewBag.Order.Id }) %>">
                                                <%:"Review".Localize() %> </a>
                                            <%}
                                            %>
                                        </td>
                                    </tr>
                                    <%
                                    
                                        } %>
                                </tbody>
                            </table>
                        </div>
                        <div class="total">
                            <dl>
                                <dt>
                                    <%:"Order Discount:".Localize() %></dt>
                                <dd>
                                    <%: ViewBag.Order.Discount.ToString("C")%>
                                </dd>
                            </dl>
                            <dl>
                                <dt>
                                    <%:"SubTotal:".Localize() %></dt>
                                <dd>
                                    <%: ViewBag.Order.SubTotal.ToString("C") %></dd>
                            </dl>
                            <dl>
                                <dt>
                                    <%:"Total Discount:".Localize() %></dt>
                                <dd>
                                    <%: ViewBag.Order.TotalDiscount.ToString("C")%></dd>
                            </dl>
                            <dl>
                                <dt>
                                    <%:"Total Tax Cost:".Localize() %></dt>
                                <dd>
                                    <%: ViewBag.Order.TotalTaxCost.ToString("C") %></dd>
                            </dl>
                            <dl>
                                <dt>
                                    <%:"ShippingCost:".Localize() %></dt>
                                <dd>
                                    <%: ViewBag.Order.ShippingCost.ToString("C")%></dd>
                            </dl>
                            <dl>
                                <dt>
                                    <%:"PaymentMethodCost:".Localize() %></dt>
                                <dd>
                                    <%: ViewBag.Order.PaymentMethodCost.ToString("C")%></dd>
                            </dl>
                            <dl>
                                <dt>
                                    <%:"Total:".Localize() %></dt>
                                <dd>
                                    <%: ViewBag.Order.Total.ToString("C")%></dd>
                            </dl>
                        </div>
                    </div>
                    <strong>
                        <%:"Order Info".Localize() %></strong>
                    <div class="tab-block">
                        <div class="common-table">
                            <table>
                                <thead>
                                    <tr>
                                        <th>
                                            <%:"Date Added".Localize() %>
                                        </th>
                                        <th>
                                            <%:"Status".Localize() %>
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td>
                                            <%: ViewBag.Order.OrderDate.ToString("F") %>
                                        </td>
                                        <td>
                                            <%: ((IOrder)ViewBag.Order).OrderStatus %>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="tab-block">
                        <a class="button left" href="<%: Url.Action("OrderList") %>"><span>
                            <%:"Back".Localize() %></span></a>
                        <%
                            if (((IOrder)ViewBag.Order).OrderStatus == OrderStatus.PaymentPending)
                            {
                        %>
                        <%
                                using (Html.BeginForm("Pay", "Account", new { id = ViewBag.Order.Id }))
                                {
                        %>
                        <button class="button right" type="submit">
                            <em><span>
                                <%:"Pay Now".Localize() %></span></em>
                        </button>
                        <%
                                }
                            } %>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Breadcrumb" runat="server">
    <ul class="breadcrumb">
        <li><a href="/">
            <%:"Home".Localize() %></a>&gt;</li>
        <li><a href="/my">
            <%:"Account".Localize() %></a>&gt;</li>
        <li>
            <%:"Orders".Localize() %></li>
    </ul>
</asp:Content>
